<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%--
  Created by IntelliJ IDEA.
  User: MaTengLong
  Date: 2021/8/3
  Time: 10:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>学员列表</title>
</head>
<body>
<div style="text-align: center">
<table style="margin: auto" width="60%">
    <tr>
        <th>学号</th>
        <th>姓名</th>
        <th>性别</th>
        <th>生日</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${students}" var="student" varStatus="num">
        <c:if test="${num.count%2 != 0}">
            <tr bgcolor="#7fff00">
                <td>${student.id}</td>
                <td>${student.name}</td>
                <td>${student.gender}</td>
                <td><fmt:formatDate value="${student.bornday}" pattern="yyyy年MM月dd日"></fmt:formatDate> </td>
                <td><a href="show?id=${student.id}">查看</a> | <a href="update?id=${student.id}">编辑</a>|<a href="delete?id=${student.id}">删除</a> </td>
            </tr>
        </c:if>
        <c:if test="${num.count%2 == 0}">
            <tr bgcolor="#ffe4e1">
                <td>${student.id}</td>
                <td>${student.name}</td>
                <td>${student.gender}</td>
                <td><fmt:formatDate value="${student.bornday}" pattern="yyyy年MM月dd日"></fmt:formatDate> </td>
                <td><a href="show?id=${student.id}">查看</a> | <a href="update?id=${student.id}">编辑</a>|<a href="delete?id=${student.id}">删除</a> </td>
            </tr>
        </c:if>
    </c:forEach>
</table>
</div>
<h3><a href="add">新增学员</a></h3>
<form action="add" method="get">
    <h3><input type="submit" value="新增学员"></h3>
</form>


<c:forEach items="${students}" var="student">
    <div>${student.name}</div>
</c:forEach>
</body>
</html>
